package com.funo.logic.generate.wrapper;

/**
 * 方法调用包装器
 * @since 2024年7月25日17:25:39
 * @author cms
 */
public class MethodInvokeWrapper extends ClassWrapper {

    private String methodName;

    public static MethodInvokeWrapper of(String name, String methodName) {
        MethodInvokeWrapper wrapper = new MethodInvokeWrapper();
        wrapper.setFullName(name);
        wrapper.setName(getClassShortRawName(name));
        wrapper.setShortName(getClassShortName(name));
        wrapper.setMethodName(methodName);
        return wrapper;
    }

    public static MethodInvokeWrapper of(Class clazz, String methodName) {
        return of(clazz.getName(), methodName);
    }

    public String generateCode() {
        StringBuffer codeBuffer = new StringBuffer();
        codeBuffer.append(getShortName()).append(".").append(getMethodName());
        return codeBuffer.toString();
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }
}
